//
//  ViewController.m
//  HSMediator
//
//  Created by fan on 2021/10/15.
//

#import "ViewController.h"
#import "HSMediator+ModuleA/HSMediator+ModuleA.h"
#import "HSMediator+ModuleC/HSMediator+ModuleC.h"
#import "HSMediator-Swift.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"Home";
}

- (IBAction)pushModuleA:(id)sender {
    
    UIViewController *vc = [[HSMediator sharedInstance] viewControllerWith:@"to ModuleA" callBack:^(NSString * text) {
        NSLog(@"callBack == %@", text);
    }];
    
    [self.navigationController pushViewController:vc animated:YES];
}
- (IBAction)pushModuleB:(id)sender {
    
    UIViewController *vc = [[HSMediator sharedInstance] dispatchWithUrl:[NSURL URLWithString:@"zhiying://ModuleBTarget/bViewController"]];
    
    [self.navigationController pushViewController:vc animated:YES];
}

- (IBAction)pushModuleC:(UIButton *)sender {
    UIViewController *vc = [[HSMediator sharedInstance] cViewControllerWith:@"ModuleC" callBack:^(NSString * title) {
        NSLog(@"ModuleC 回调 %@", title);
        [sender setTitle:title forState:UIControlStateNormal];
    }];
    [self.navigationController pushViewController:vc animated:YES];
}


@end
